package com.wolf.exception;

import com.wolf.provider.exception.ERROR_MSG;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * 异常类
 *
 * @author sdyang
 * @date 2016/12/18 18:03.
 */
public class WolfException extends RuntimeException {

    private final Logger logger = LoggerFactory.getLogger(this.getClass());

    public WolfException(){
        super();
    }

    public WolfException(String str){
        super(str);
        logger.error(str);
    }

    public static void report(ERROR_MSG errorMsg, Object... args) {
        throw new WolfException(String.format(errorMsg.getErrorMessage(), args));
    }

    public static void report(ETL_ERROR_MSG errorMsg, Object... args) {
        throw new WolfException(String.format(errorMsg.getErrorMessage(), args));
    }
}
